<template>
    <fieldset>
        <legend>setup钩子</legend>
        <h1>选项props:{{ msg }}</h1>
        <h1>setup:{{ msg2 }}</h1>
        <h1>setup:{{ name }}</h1>
    </fieldset>
</template>
<script>

//使用toRefs来让数据保持响应
import {toRefs} from "vue"

export default {
    setup(props, context) {
        console.log("props==", props)
        console.log("context ", context)

        //setup可以有返回值,返回值可以直接展示到模板(视图层)

        let {msg: msg2} = toRefs(props);

        return {
            msg2,
            name: '李雷'
        }
    },
    props: ['msg']
}
</script>
